home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / src / deliver / ch_wtmail.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-10-02  |  3.4 KB  |  133 lines

  1. #include "util.h"
  2. #include "mmdf.h"
  3.  
  4. /*
  5.  *     MULTI-CHANNEL MEMO DISTRIBUTION FACILITY  (MMDF)
  6.  *
  7.  *
  8.  *     Copyright (C) 1979,1980,1981  University of Delaware
  9.  *
  10.  *     Department of Electrical Engineering
  11.  *     University of Delaware
  12.  *     Newark, Delaware  19711
  13.  *
  14.  *     Phone:  (302) 738-1163
  15.  *
  16.  *
  17.  *     This program module was developed as part of the University
  18.  *     of Delaware's Multi-Channel Memo Distribution Facility (MMDF).
  19.  *
  20.  *     Acquisition, use, and distribution of this module and its listings
  21.  *     are subject restricted to the terms of a license agreement.
  22.  *     Documents describing systems using this module must cite its source.
  23.  *
  24.  *     The above statements must be retained with all copies of this
  25.  *     program and may not be removed without the consent of the
  26.  *     University of Delaware.
  27.  *     
  28.  *
  29.  *     version  -1    David H. Crocker    March   1979
  30.  *     version   0    David H. Crocker    April   1980
  31.  *     version  v7    David H. Crocker    May     1981
  32.  *     version   1    David H. Crocker    October 1981
  33.  *
  34.  */
  35. /*  CH_IO:  Channel invocation & communication                          */
  36.  
  37. /*  Jun 80 Dave Crocker     fix ch_close fildes setting to -1
  38.  *  Nov 80 Dave Crocker     convert to ch_struct pointer from ch_code
  39.  *  Jul 81 Dave Crocker     ch_rdrec a little cleaner on error handling
  40.  */
  41.  
  42. /*#define RUNALON                 /* run without invoking actual channels */
  43.  
  44. #include "ch.h"
  45. #include <signal.h>
  46.  
  47. extern char pgm_bakgrnd;
  48. extern struct ll_struct   *logptr;
  49. extern char *chndfldir;
  50.  
  51.  
  52. /*  **************  (ch_) WRITE MAIL TO AND ADDRESS  ***************** */
  53.  
  54.  
  55. ch_winit (ret, msg)    /* initial parameters for a message   */
  56. char *ret, *msg;           /* name of message                    */
  57. {
  58.     RP_Buf rply;
  59.     int len;
  60.     int retval;
  61.     char linebuf[LINESIZE];
  62.  
  63. #ifdef DEBUG
  64.     ll_log (logptr, LLOGFTR, "ch_winit (%s, %s)", ret, msg);
  65. #endif
  66.  
  67.     arg2lstr (0, LINESIZE, linebuf, "msg", msg, ret, (char *)0);
  68.  
  69.     if (rp_isgood (retval = ch_wrec (linebuf)))
  70.     if (rp_isgood (retval = ch_rrply (&rply, &len)))
  71.     {
  72.         retval = rply.rp_val;
  73.         if (rp_isbad (retval))
  74.         printx ("Problem with queue: %s\n", rply.rp_line);
  75.     }
  76.     return (retval);
  77. }
  78. /* */
  79.  
  80. ch_wadr (host, adr)             /* send channel an address              */
  81.     char host[],
  82.      adr[];
  83. {
  84.     char linebuf[LINESIZE];
  85.  
  86. #ifdef DEBUG
  87.     ll_log (logptr, LLOGFTR, "ch_wadr (%s, %s)", host, adr);
  88. #endif
  89.  
  90.     arg2lstr (0, LINESIZE, linebuf, "addr", host, adr, (char *)0);
  91.  
  92.     return (ch_wrec (linebuf));
  93. }
  94.  
  95. ch_whend ()                     /* end of sub-list for this host        */
  96. {
  97.     RP_Buf rply;
  98.     int len,
  99.     retval;
  100.  
  101.     if (rp_isgood (retval = ch_wrec ("hend")))
  102.     if (rp_isgood (retval = ch_rrply (&rply, &len)))
  103.     {
  104.         retval = rply.rp_val;
  105.         if (rp_isbad (retval) && rp_gval (retval) != RP_NOOP)
  106.         printx ("Problem host ending: %s\n", rply.rp_line);
  107.     }
  108. #ifdef DEBUG
  109.     ll_log (logptr, LLOGFTR, "ch_hend (%s)", rp_valstr (retval));
  110. #endif
  111.     return (retval);
  112. }
  113.  
  114. ch_waend ()                     /* end of list for channel              */
  115. {
  116.     RP_Buf rply;
  117.     int len,
  118.     retval;
  119.  
  120.     if (rp_isgood (retval = ch_wrec ("aend")))
  121.     if (rp_isgood (retval = ch_rrply (&rply, &len)))
  122.     {
  123.         retval = rply.rp_val;
  124.         if (rp_isbad (retval))
  125.         printx ("Problem address ending: %s\n", rply.rp_line);
  126.     }
  127. #ifdef DEBUG
  128.     ll_log (logptr, LLOGFTR, "ch_waend (%s)", rp_valstr (retval));
  129. #endif
  130.     return (retval);
  131. }
  132.  
  133.